//
//  PointClassTableViewCell1.m
//  fitnessmanage
//
//  Created by wujian on 2018/1/22.
//  Copyright © 2018年 zongquankeji. All rights reserved.
//

#import "PointClassTableViewCell1.h"

@implementation PointClassTableViewCell1

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        /**
         课程图片
         */
        UIImageView *courseImageView = [[UIImageView alloc] init];
        courseImageView.layer.cornerRadius = 3;
        courseImageView.layer.masksToBounds = YES;
        courseImageView.image = PlaceHold;
        [self.contentView addSubview:courseImageView];
        self.courseImageView = courseImageView;
        
        /**
         课程名字
         */
        UILabel *courseLabel = [[UILabel alloc] init];
        courseLabel.font = MidBigFont;
        courseLabel.textColor = CSColorFromRGB(0x0a0a0a);
        [self.contentView addSubview:courseLabel];
        self.courseLabel = courseLabel;
        
        
        /**
         店名
         */
        UIButton *placeBtn = [[UIButton alloc] init];
        [placeBtn setTitle:@"艺术中心店"];
        [placeBtn setImage:@"icon_xshop"];
        placeBtn.titleLabel.font = SmallFont;
        [placeBtn setTitleColor:CSColorFromRGB(0x888888)];
        [self.contentView addSubview:placeBtn];
        self.placeBtn = placeBtn;
        
        
        /**
         时长
         */
        UIButton *timeBtn = [[UIButton alloc] init];
        [timeBtn setTitle:@"60分"];
        [timeBtn setImage:@"icon_xtime"];
        timeBtn.titleLabel.font = SmallFont;
        [timeBtn setTitleColor:CSColorFromRGB(0x888888)];
        [self.contentView addSubview:timeBtn];
        self.timeBtn = timeBtn;
        
        
        UIImageView *rightImageView = [[UIImageView alloc] init];
        rightImageView.image = [UIImage imageNamed:@"xiayibu"];
        [self.contentView addSubview:rightImageView];
        self.rightImageView = rightImageView;
        
        [self setConstraints];
        
    }
    
    return self;
}

-(void)setConstraints{
    
    /**
     课程名字
     */
    [self.courseImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.top.left.mas_equalTo(self.contentView).offset(15);
        
        make.height.width.mas_equalTo(80);
        
        make.bottom.mas_equalTo(self.contentView).offset(-15);
    }];
    
    
    /**
     课程名字
     */
    [self.courseLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.top.mas_equalTo(self.courseImageView).offset(5);
        
        make.left.mas_equalTo(self.courseImageView.mas_right).offset(10);
    }];
    
    /**
     店名
     */
    [self.placeBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.courseLabel);
        
        make.top.mas_equalTo(self.courseLabel.mas_bottom).offset(8);
    }];
    [self.placeBtn imageOnTheTitleLeftWithSpace:3];
    
    /**
     时长
     */
    [self.timeBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.courseLabel);
        
        make.top.mas_equalTo(self.placeBtn.mas_bottom).offset(5);
    }];
    [self.timeBtn imageOnTheTitleLeftWithSpace:3];
    
    
    [self.rightImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.centerY.mas_equalTo(self.contentView);
        
        make.right.mas_equalTo(self.contentView).offset(-10);
    }];
}

@end
